public class Sort {
    public static void main(String[] args) {
        int[] nums = {110,100,0};
        //快速排序
        //quickSort(nums,0,nums.length-1);
        //选择排序
        selectSort(nums);
        for(int i : nums) {
            System.out.print(i+" ");
        }
    }
    //快速排序
    private static void quickSort(int[] nums, int start, int end) {
        if(start >= end) {
            return;
        }
        int left = start;
        int right = end;
        int tmp = nums[left];
        while(left < right) {
            while(left < right && nums[right] >= tmp) {
                right--;
            }
            nums[left] = nums[right];
            while(left < right && nums[left] <= tmp) {
                left++;
            }
            nums[right] = nums[left];
        }
        nums[left] = tmp;
        //排序左半边
        quickSort(nums,start,left-1);
        //排序右半边
        quickSort(nums,left+1,end);
    }
    //选择排序
    private static void selectSort(int[] nums) {
        for(int i = 0; i < nums.length; i++) {
            int min = Integer.MIN_VALUE;
            int minIndex = i;
            for (int j = i; j < nums.length; j++) {
                if(nums[j] < min) {
                    min = nums[j];
                    minIndex = j;
                }
            }
            if(minIndex != i) {
                swap(nums,i,minIndex);
            }
        }
    }
    private static void swap(int[] nums,int i,int j) {
        int tmp = nums[i];
        nums[i] = nums[j];
        nums[j] = tmp;
    }
}
